<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类数组转换成数组</title>
</head>
<body>
<script>

    Array.prototype.slice = function (){
        console.log(this); //this = arguments
        let newArr = [];
        for (let i=0;i<this.length;i++){
            newArr.push(this[i])
        }

        return newArr
    }
    let arr = [1,2,34];

    let arr2 = arr.slice();

    arr2[0] = 1000;
    console.log(arr,arr2);



    /*function fn(){

        let arr = Array.from(arguments);


        let arr2 = Array.prototype.slice.call(arguments)
        let arr3 = [].slice.call(arguments)


        console.log(arguments);
        console.log(arr,arr2);


    }
    fn(1,2,3,4,5)*/
</script>
</body>
</html>